import request from "@/utils/request"

export const loginApi = async (data) => {
  return await request.post(`~/login`, data)
}

export const subjectApi = async () => {
  const res = await request.get(`~/subject`)
  return res.data
}

export const switchToApi = async (loginId: string) => {
  const res = await request.get(`~/switchTo`, { params: { loginId }})
  return res.data
}

export const endSwitchApi = async () => {
  const res = await request.get(`~/endSwitch`)
  return res.data
}

export const fieldAuthsApi = async () => {
  return await request.get('~/fieldAuths')
}

export const profileApi = async () => {
  const res = await request.get(`~/profile`)
  return res.data
}

export const logoutApi = async () => {
  return await request.get(`~/logout`)
}

export const appApi = async () => {
  return await request.get(`~`)
}

export const flexDataSourceApi = async () => {
  return await request.get(`~/flexDataSource`)
}

export const switchableApi = async () => {
  return await request.get('~/switchable')
}

export const actionApi = async (owner, ownerId) => {
  return await request.get('~/action', { params: { owner, ownerId }})
}
